package com.wing.order.model.response;

import com.baomidou.mybatisplus.core.enums.IEnum;
import com.wing.order.model.entity.OrderReceiveDetail;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 领货单VO
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class OrderReceiveDetailVO {



    /**
     * ID
     */
    private Long id;

    /**
     * 创建时间
     */
    @JsonFormat(timezone = "GMT+8" , pattern = "yyyy-MM-dd HH:mm:ss" )
    private LocalDateTime createTime;

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 领货单id
     */
    private Long receiveId;

    /**
     * sku code
     */
    private String skuCode;

    /**
     * 领取数量
     */
    private Integer quantity;

    /**
     * 配货需求单id
     */
    private Long demandId;

    /**
     * 配货需求单明细id
     */
    private Long demandDetailId;


    private OrderReceiveDetail.Status status;


    /**
     * sku 名称
     */
    private String skuName;



    /**
     * sku 规格
     */
    private String skuSpec;

    /**
     * sku 图片
     */
    private String skuPic;

    /**
     * 产品类型名称
     */
    private String productTypeName;

    /**
     * 产品分类名称
     */
    private String productCategoryName;

    /**
     * 产品品牌
     */
    private String productBrandName;

    /**
     * 产品型号
     */
    private String productModelName;


    /**
     * 市场价
     */
    private BigDecimal marketPrice;

    /**
     * 已领货数量
     */
    private Integer quantityReceive;

    /**
     * 已上货数量
     */
    private Integer quantityLoad;


    private Integer quantityConfirm;

    private Long skuId;

    private Long loadPlanId;

    private Long loadPlanDetailId;


    private Integer quantitySurplus;


    public Integer getQuantitySurplus(){
        if (this.quantityLoad!=null&&this.quantityReceive!=null){
            return this.quantityReceive-this.quantityLoad;
        }else if (this.quantityReceive!=null){
            return this.quantityReceive;
        }else{
            return 0;
        }
    }



    public Integer getQuantityLoad(){
        if (this.quantityLoad==null){
            return 0;
        }
        return this.quantityLoad;
    }

}
